Skip to content

Conversation

@adam-enko
Copy link
Member

From what I can tell, the Kotlin Reflect dependency is unnecessary.

To avoid clashes with Gradle's embedded Kotlin, and with other plugins, Gradle plugins should avoid using unnecessary dependencies.

@fzhinkin
Copy link
Collaborator

There's in fact a single explicit usage of the reflect library in the plugin. :)

In general, it seems like the proper should be similar to what was done in #235 for compiler-embeddable, and dependencies like kotlinpoet, reflect, and klib-related stuff should all be moved into a separate configuration.

@fzhinkin fzhinkin closed this Nov 13, 2025
@adam-enko
Copy link
Member Author

There's in fact a single explicit usage of the reflect library in the plugin. :)

Please could you share it here?

@fzhinkin
Copy link
Collaborator

"${holder.kotlin.qualifiedName ?: holder.name}.${function.kotlinFunction?.name ?: function.name}"

@adam-enko
Copy link
Member Author

"${holder.kotlin.qualifiedName ?: holder.name}.${function.kotlinFunction?.name ?: function.name}"

Thanks! This code is inside a Worker, so the classpath should be isolated. This means the dependency can be changed from implementation to compileOnly.

implementation(libs.kotlin.reflect)

adam-enko added a commit that referenced this pull request Nov 24, 2025
The only usage of Kotlin Reflect is inside a Worker[1], so the classpath is isolated. This means the Kotlin Reflect dependency can be changed from `implementation` to `compileOnly`.

To avoid clashes with Gradle's embedded Kotlin, and with other plugins, Gradle plugins should avoid using unnecessary dependencies.

Continuation of #229

[1] https://github.com/Kotlin/kotlinx-benchmark/blob/e9becb5101be4e458e1cfcd07936571f85bcb569/plugin/main/src/kotlinx/benchmark/gradle/JmhBytecodeGeneratorWorker.kt#L187
@adam-enko adam-enko deleted the adam/fix/plugin-remove-kotlin-native branch November 24, 2025 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants